﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;

namespace CoreSystem
{

    public class SysBaseMenuItem
    {
        // Fields
        protected string _Caption;
        protected string _Description;
        protected bool _Enable;
        protected string _Icon_File;
        protected int _Level_Menu;
        protected string _Menu_Id;
        protected string _Module_Name;
        protected string _Name_Menu;
        protected string _Not_In_Module;
        protected string _Parents;
        protected string _Short_Cut;
        protected bool _Visible;
        protected System.Windows.Forms.Keys shortcutkey= System.Windows.Forms.Keys.None;
        public SysBaseMenuItem()
        { }
        public SysBaseMenuItem(string _Menu_Id, string _Name_Menu, string _Caption, string _Description, int _Level_Menu, string _Parents, bool _Enable, bool _Visible, string _Icon_File, string _Short_Cut, string _Module_Name, string _Not_In_Module)
        {
            this.Menu_Id = _Menu_Id;
            this.Name_Menu = _Name_Menu;
            this.Caption = _Caption;
            this.Description = _Description;
            this.Level_Menu = _Level_Menu;
            this.Parents = _Parents;
            this.Enable = _Enable;
            this.Visible = _Visible;
            this.Icon_File = _Icon_File;
            this.Short_Cut = _Short_Cut;
            this.Module_Name = _Module_Name;
            this.Not_In_Module = _Not_In_Module;                       
        }

        // Properties
        public string Caption
        {
            get
            {
                return this._Caption;
            }
            set
            {
                this._Caption = value;                
            }
        }

        public string Description
        {
            get
            {
                return this._Description;
            }
            set
            {
                this._Description = value;
            }
        }

        public bool Enable
        {
            get
            {
                return this._Enable;
            }
            set
            {
                this._Enable = value;
            }
        }

        public string Icon_File
        {
            get
            {
                return this._Icon_File;
            }
            set
            {
                this._Icon_File = value;
            }
        }

        public int Level_Menu
        {
            get
            {
                return this._Level_Menu;
            }
            set
            {
                this._Level_Menu = value;
            }
        }

        public string Menu_Id
        {
            get
            {
                return this._Menu_Id;
            }
            set
            {
                this._Menu_Id = value;
            }
        }

        public string Module_Name
        {
            get
            {
                return this._Module_Name;
            }
            set
            {
                this._Module_Name = value;
            }
        }

        public string Name_Menu
        {
            get
            {
                return this._Name_Menu;
            }
            set
            {
                this._Name_Menu = value;
            }
        }

        public string Not_In_Module
        {
            get
            {
                return this._Not_In_Module;
            }
            set
            {
                this._Not_In_Module = value;
            }
        }

        public string Parents
        {
            get
            {
                return this._Parents;
            }
            set
            {
                this._Parents = value;
            }
        }

        public string Short_Cut
        {
            get
            {
                return this._Short_Cut;
            }
            set
            {
                shortcutkey = Keys.None;
                string[] _keystring = value.Split('+');
                KeysConverter objKeyConverter = new KeysConverter();
                object _Keycode;

                foreach (string item in _keystring)
                {
                    _Keycode = objKeyConverter.ConvertFromString(item) ;
                    if (_Keycode is Keys) shortcutkey |= (Keys)_Keycode;
                }                
                this._Short_Cut = value;                
            }
        }

        public bool Visible
        {
            get
            {
                return this._Visible;
            }
            set
            {
                this._Visible = value;
            }
        }
        public virtual object MenuDropDownItem
        {
            get { return new object(); }
        }
    }
}
